import thenFs from 'then-fs'

// 基于 Promise 方式读取文件内容

thenFs.readFile('./files/0.txt')
  .then(r1 => {
    console.log(r1.toString())
    return thenFs.readFile('./files/2.txt')
  })
  .then(r2 => {
    console.log(r2.toString())
    return thenFs.readFile('./files/3.txt')
  })
  .then(r3 => {
    console.log(r3.toString())
  })
  .catch((err) => {
    console.log(`${err.message}`)
  })

// 链式编程中第二个thenFs读取出现错误打印结果
// 111
// ENOENT: no such file or directory, open 'D:\WebstormProjects\js-learn\node\files\4.txt'


// 链式编程中最后一个thenFs读取出现错误打印结果
// 111
// 222
// ENOENT: no such file or directory, open 'D:\WebstormProjects\js-learn\node\files\4.txt'

